package com.leyou.common.util;

import java.util.Collection;

/**
 * @author zqq
 * @ClassName StringUtil
 * @Description: 字符串工具类
 * @date 2020/3/6-16:42
 */
public class StringUtil {

    /**
     * @Title: isEmpty
     * @Description: 判断传入的字符串、数组、集合是否为空
     * @author: zqq
     * @param obj
     * @return: boolean
     * @createTime: 2020-03-06 16:44
     * @version: v.1.0
     */
    public static boolean isEmpty(Object obj) {
        if ((obj instanceof String)) {
            if ((obj == null) || ("".equals((String) obj)) || ((String) obj).length() == 0) {
                return false;
            }
            return true;
        }
        if ((obj instanceof Object[])) {
            if ((obj == null) || (((Object[]) obj).length == 0)) {
                return false;
            }
            return true;
        }
        if ((obj instanceof Collection)) {
            if ((obj == null) || (((Collection) obj).size() == 0)) {
                return false;
            }
            return true;
        }
        if (obj == null) {
            return false;
        }
        return true;
    }
}
